package com.yuanfeng.activity.controller;

import com.yuanfeng.activity.dto.NoneGoodsUpdateDTO;
import com.yuanfeng.commoms.util.ResponseResult;
import com.yuanfeng.commoms.vo.goods.NoneGoodsQueryDTO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * @ClassName ActivityNoneGoodsController
 * @Description
 * @Author hyq
 * @Date 2023/7/6 14:27
 * @Version 1.0
 **/
@RestController
@RequestMapping("activity/noneGoods")
public class ActivityNoneGoodsController extends BaseController{

    /**
     * 删除活动专区
     *
     * @param param
     * @return
     */
    @PostMapping("/delete")
    public ResponseResult deleteNoneGoods(@RequestBody NoneGoodsUpdateDTO param) {
        ResponseResult result=activityNoneGoodsService.deleteNoneGoods(param);
        return result;

    }

    /**
     * 添加或更新活动专区商品
     *
     * @param param
     * @return
     */
    @PostMapping("/update")
    public ResponseResult updateActivityNoneGoods(@RequestBody NoneGoodsUpdateDTO param) {

        ResponseResult result=activityNoneGoodsService.updateActivityNoneGoods(param);
        return result;

    }


    /**
     * 查询活动专区商品
     *
     * @param param
     * @return
     */
    @PostMapping("/queryList")
    public ResponseResult queryNoneGoods(@RequestBody NoneGoodsQueryDTO param) throws IllegalAccessException {
        ResponseResult result=activityNoneGoodsService.queryNoneGoods(param);
        return result;
    }

    /**
     * 查询参与对应活动的商品列表
     *
     * @param param
     * @return
     */
    @PostMapping("/query")
    public ResponseResult queryActivityGoods(@RequestBody NoneGoodsQueryDTO param) throws IllegalAccessException {
        ResponseResult result=activityNoneGoodsService.queryActivityGoods(param);
        return result;
    }



    /**
     * 导出活动专区商品
     *
     * @param param
     * @return
     */
    @PostMapping("/export")
    public ResponseResult exportNoneGoods(@RequestBody NoneGoodsQueryDTO param, HttpServletResponse response) throws IllegalAccessException {
        ResponseResult result=activityNoneGoodsService.exportNoneGoods(param,response);
        return result;
    }


    /**
     * 删除专区类型
     *
     * @return
     */
    @PostMapping("/type/delete")
    public ResponseResult deleteNoneType(@RequestBody Map<String, Object> param) {
        ResponseResult result=activityNoneGoodsService.deleteNoneType(param);
        return result;
    }
}
